From b7c0be07253d8ce20c96edd3de64412b78bf9bc3 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 27 May 2018 08:10:07 -0600 Subject: [PATCH] bug fixes and improvements for uploadtool. (#182) * fix body of appveyor uploads. * give detailed instructions on appveyor upload when GITHUB_TOKEN missing. * pick up upstream changes to upload.sh. --- tools/uploadtool/upload.sh | 5 +++-- tools/uploadtool/upload_appveyor.sh | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/uploadtool/upload.sh b/tools/uploadtool/upload.sh index 03ee58aa4..f39955038 100755 --- a/tools/uploadtool/upload.sh +++ b/tools/uploadtool/upload.sh @@ -150,13 +150,14 @@ if [ "$TRAVIS_COMMIT" != "$target_commit_sha" ] ; then fi if [ ! -z "$TRAVIS_JOB_ID" ] ; then - if [ ! -z "$UPLOADTOOL_BODY" ] ; then + if [ -z "${UPLOADTOOL_BODY+x}" ] ; then + # TODO: The host could be travis-ci.org (legacy open source) or travis-ci.com (subscription or latest open source). BODY="Travis CI build log: https://travis-ci.org/$REPO_SLUG/builds/$TRAVIS_BUILD_ID/" else BODY="$UPLOADTOOL_BODY" fi else - BODY="" + BODY="$UPLOADTOOL_BODY" fi release_infos=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \ diff --git a/tools/uploadtool/upload_appveyor.sh b/tools/uploadtool/upload_appveyor.sh index 4ca22274e..ac7c90201 100755 --- a/tools/uploadtool/upload_appveyor.sh +++ b/tools/uploadtool/upload_appveyor.sh @@ -80,8 +80,11 @@ if [ ! -z "$APPVEYOR_REPO_NAME" ] ; then echo "APPVEYOR_REPO_COMMIT: $APPVEYOR_REPO_COMMIT" REPO_SLUG="$APPVEYOR_REPO_NAME" if [ -z "$GITHUB_TOKEN" ] ; then - echo "\$GITHUB_TOKEN missing, please set it in the Appveyor CI settings of this project" - echo "You can get one from https://github.com/settings/tokens" + echo "\$GITHUB_TOKEN missing." + echo "You can get one from https://github.com/settings/tokens." + echo "Encrypt it at https://ci.appveyor.com/tools/encrypt when logged into Appveyor account $APPVEYOR_ACCOUNT_NAME," + echo "then set it at https://ci.appveyor.com/project/$APPVEYOR_ACCOUNT_NAME/$APPVEYOR_PROJECT_SLUG/settings/environment or" + echo "put it in appveyor.yml as described at https://www.appveyor.com/docs/build-configuration/#secure-variables" exit 1 fi else @@ -151,13 +154,13 @@ if [ "$APPVEYOR_REPO_COMMIT" != "$target_commit_sha" ] ; then fi if [ ! -z "$APPVEYOR_JOB_ID" ] ; then - if [ ! -z "$UPLOADTOOL_BODY" ] ; then - BODY="Appveyor CI build log: https://ci.appveyor.com/project/$REPO_SLUG/build/$APPVEYOR_BUILD_VERSION/" + if [ -z "${UPLOADTOOL_BODY+x}" ] ; then + BODY="Appveyor CI build log: https://ci.appveyor.com/project/$APPVEYOR_ACCOUNT_NAME/$APPVEYOR_PROJECT_SLUG/build/$APPVEYOR_BUILD_VERSION/" else BODY="$UPLOADTOOL_BODY" fi else - BODY="" + BODY="$UPLOADTOOL_BODY" fi release_infos=$(curl -s -S -H "Authorization: token ${GITHUB_TOKEN}" \ -- 2.30.2